<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib  prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="redis" uri="http://www.shopjsp.com/redisTag/functions" %>
<c:set var="basePath" value="${redis:getSysConfig('base_path_back')}"/>
<c:set var="srcPath" value="${redis:getSysConfig('sysFileVisitRoot_back')}"/>
<c:set var="websiteUrl" value="${redis:getSysConfig('websiteUrl')}"/>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="utf-8">
	<title>欢迎登录军工人之家平台管理系统</title>
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
	<link rel="shopjsp icon" href="${srcPath}/common/images/sj.ico"/>
	<!-- CSS -->
	<link rel="stylesheet" href="${srcPath}/login/css/reset.css"/>
	<link rel="stylesheet" href="${srcPath}/login/css/supersized.css"/>
	<link rel="stylesheet" href="${srcPath}/login/css/style.css"/>
	<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	<script src="${srcPath}/login/js/html5shiv.js"></script>
	<![endif]-->
	<script type="text/javascript" src="${srcPath}/login/js/mouseFlow.js"></script>
	<style>
		canvas{position: fixed; top: 0px; left: 0px; }
	</style>
</head>

<body id="body">
<script type="text/javascript">
    mouseFlow();/** 登录页面加载背景鼠标跟随效果 **/
	var domain_img="${srcPath}/login/images"; /**为登录背景图片设置域名路径**/
</script>
<div class="page-container">
	<!--<div><img src="${srcPath}/common/images/logo.png"/></div><br>  -->
	<h1>欢迎登录军工人之家商城运营管理系统</h1>

	<form id="form1" action="${basePath}/backLogin/login.sjson" method="post">
		<input type="text" name="userName" id="userName" placeholder="用户名"/>
		<input type="text" name="password" id="password" placeholder="密码" onfocus="this.type='password'"/>
		<button type="button" id="login">登录</button>
		<button type="button" id="home" class="home">商城首页</button>
		<div class="error"><span>+</span></div>
	</form>
</div>
<!-- Javascript -->
<script  src="${srcPath}/common/js/jquery-1.8.0.min.js"></script>
<script  src="${srcPath}/login/js/supersized.3.2.7.min.js"></script>
<script  src="${srcPath}/login/js/supersized-init.js"></script>
<script  src="${srcPath}/3thParty/layer/layer.js"></script>

<script type="text/javascript">

    $(function() {

        /**
         * 判断是否在iframe中
         * iframe页面是内嵌到父页面，刷新父页面
         * **/
        if (window.frames.length != parent.frames.length) {
            //alert('测试页面是否在iframe中');
            parent.location.reload();
        }

        /** 回车事件绑定 **/
        document.onkeydown=function(event){
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if(e && e.keyCode==13){
                $('#login').click();
            }
        };

        /** 登录操作 **/
        $('#login').click(function(){
            var userName = $('#userName').val();
            var password = $('#password').val();
            if(userName == '') {
                $('.error').fadeOut('fast', function(){
                    $('.error').css('top', '27px').show();
                });
                $('.error').fadeIn('fast', function(){
                    $('#userName').focus();
                });
                return false;
            }
            if(password == '') {
                $('.error').fadeOut('fast', function(){
                    $('.error').css('top', '96px').show();
                });
                $(this).find('.error').fadeIn('fast', function(){
                    $('#password').focus();
                });
                return false;
            }

            $.ajax({
                type:"post",
                dataType:"json",
				async:false,
                url:"${basePath}/backLogin/login.sjson",
                data:{userName:userName,password:password},
                success:function(result){
                    var load = layer.load();
                    layer.close(load);
                    layer.msg(result.msg);
                    if(result.success){
                        /** 进入管理系统控制台界面 **/
                        setTimeout(function(){window.location.href= "${basePath}/back/workspace/index.htm";},100);
                    }else{
                        $('#password').val('');
                    }
                }
            });
            return false;
        });

        $('.page-container form #loginName, .page-container form #password').keyup(function(){
            $(this).parent().find('.error').fadeOut('fast');
        });

        /** 注册 **/
        $("#home").click(function(){
            window.open('${websiteUrl}');
        });
    });
</script>
</body>

</html>


